<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>


    <script>


        // 用call继承另外一个函数的方法 和属性
        function Sn(name, age) {
            this.name = name
            this.age = age
            this.sum = function () {
                console.log("我的名字叫" + name + "今年" + age + "岁");
            }
        }

        function Fn(name, age) {
            Sn.call(this, name, age)
            console.log(this);

        }

        var fn = new Fn("刘德华", 18);
        fn.sum()


        // Fn继承了Sn的属性和方法

    </script>
</body>

</html>